IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'spAttachmentSelectById') AND type in (N'P', N'PC'))
	DROP PROCEDURE spAttachmentSelectById
GO
-- =============================================
-- Author:		NamTP
-- Create date: Oct 22, 2014
-- Description:	Select attachment file
-- =============================================
CREATE PROCEDURE spAttachmentSelectById
	@Id BIGINT
AS
BEGIN
	
	SELECT CAST([Id] AS BIGINT) AS Id
      ,CAST([MediaBinary] AS VARBINARY(MAX)) AS MediaBinary
      ,[MimeType]
      ,[Published]
      ,CAST([PressreleaseId] AS BIGINT) AS PressreleaseId
      ,[FileName]
      ,[Location]
      ,[DisplayOrder]
      ,[LangId]
      ,[IsBlob]
      ,[CreatedOn]
      ,[UpdatedOn]
  FROM [Attachment]
  WHERE Id = @Id
END
GO
